home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 February / CMCD0205.ISO / Software / Freeware / Programare / bluej / bluejsetup-203.exe / {app} / examples / people2 / Staff.java < prev    next >
Text File  |  2004-12-19  |  1KB  |  59 lines

  1. /**
  2.  * A class representing staff members for a simple BlueJ demo program.
  3.  *
  4.  * @author  Michael Kolling
  5.  * @version 1.0, January 1999
  6.  */
  7.  
  8. class Staff extends Person
  9. {
  10.     private String room;
  11.  
  12.     /**
  13.      * Create a staff member with default settings for detail information.
  14.      */
  15.     Staff()
  16.     {
  17.         super("(unknown name)", 0000);
  18.         room = "(unknown room)";
  19.     }
  20.  
  21.     /**
  22.      * Create a staff member with given name, year of birth and room
  23.      * number.
  24.      */
  25.     Staff(String name, int yearOfBirth, String roomNumber)
  26.     {
  27.         super(name, yearOfBirth);
  28.         room = roomNumber;
  29.     }
  30.  
  31.     /**
  32.      * Set a new room number for this person.
  33.      */
  34.     public void setRoom(String newRoom)
  35.     {
  36.         room = newRoom;
  37.     }
  38.  
  39.     /**
  40.      * Return the room number of this person.
  41.      */
  42.     public String getRoom()
  43.     {
  44.         return room;
  45.     }
  46.  
  47.     /**
  48.      * Return a string representation of this object.
  49.      */
  50.     public String toString()    // redefined from "Person"
  51.     {
  52.         return super.toString() +
  53.                "Staff member\n" +
  54.                "Room: " + room + "\n";
  55.     }
  56.  
  57. }
  58.  
  59.